package LeetCode.leetcode;

/**
 * 排列硬币
 * @author: leiwenkang02@meituan.com
 * @date: 2018/8/9
 * @time: 20:07
 */
public class Test441排列硬币 {
    public static void main(String[] args) {
        System.out.println(arrangeCoins(6));
    }
    public static int arrangeCoins(int n) {

        int result  = 1;
        while (n - result >= 0) {
            n -= result;
            result++;
        }
        return result - 1;
    }
}
